// ignore_for_file: file_names, must_be_immutable

import 'package:flutter/material.dart';

class MyApp12 extends StatelessWidget {
  MyApp12({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        //1.导航
        appBar: AppBar(
          title: const Text('ListView组件'),
          backgroundColor: Colors.pink,
        ),
        //2.内容
        body: ListView.builder(
          itemBuilder: (BuildContext context, int index) {
            return Container(
                width: double.infinity,
                height: 100,
                margin: EdgeInsets.all(10),
                alignment: Alignment.center,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  color: Colors.red,
                ),
                child: Text(
                  '第${index}个列表项',
                  style: TextStyle(color: Colors.white),
                ));
          },
          itemCount: 20,
        ));
  }
}
